#pragma once


#include <IXRadioBox.h>
#include "XButtonImpl.h"

template <class I>
class CXRadioBoxImpl : public CXButtonImpl<I>
{
    typedef CXButtonImpl<I> superclass;

    BEGIN_DEF_SKIN_CLASS(CXRadioBox, superclass, gs_strGuidXSkin)
        IMP_BASIC_INTF(IXRadioBox,    0)
    END_DEF_SKIN_CLASS();

    IMPL_CONTROL_OBJ(CXRadioBoxImpl, superclass, _T("RadioBox"));

public:
    CXRadioBoxImpl();
    virtual ~CXRadioBoxImpl();

public:
    // IXRadioBox
    virtual void    STDMETHODCALLTYPE   put_GroupName(IN LPCTSTR szGroupName);
    virtual void    STDMETHODCALLTYPE   get_GroupName(OUT BSTR* pbstrGroupName);

    virtual void    STDMETHODCALLTYPE   put_Check(IN BOOL bChecked);
    virtual BOOL    STDMETHODCALLTYPE   get_Check();

    virtual void    STDMETHODCALLTYPE   put_ScaleImage(IN BOOL bScaleImage);
    virtual BOOL    STDMETHODCALLTYPE   get_ScaleImage();

    virtual void    STDMETHODCALLTYPE   put_ShowImage(IN BOOL bShowImage);

public:
    // IXFrame
    virtual void    STDMETHODCALLTYPE   GetAutoSize(OUT LPSIZE pAutoSize);
    virtual void    STDMETHODCALLTYPE   Draw(XCANVAS xCanvas, const RECT& rcDraw);

public:
    // IXBaseObj
    virtual void STDMETHODCALLTYPE   OnConstruct();

protected:
    // CXRadioBoxImpl
    void    NeedImage();
    void    SyncGroupStatus();

    // CXCheckBoxImpl
    virtual void OnImageChanged();

    // CXFrameImpl
    virtual BOOL    OnClicked(const POINT* pt);

protected:
    BOOL    m_bChecked;
    BOOL    m_bShowImage;
    BOOL    m_bScaleImage;
    XString m_strGroupName;
};


class CXRadioBox : public CXRadioBoxImpl<IXRadioBox>
{
};
